package com.service;

import com.dao.UserDaoFactory;
import com.dao.user.UserDao;
import com.dao.user.UserDaoimpl;
import com.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("userService")
public class UserServiceImpl implements UserService  {
    @Autowired
    @Qualifier("userDao")
    /*@Resource(name = "userDao")*/
    @Resource
    private UserDao dao;
    //dao属性的setter访问器
    @Resource
    public void setUserDao(UserDao userDao) {
        this.dao = userDao;
    }
    public UserServiceImpl(){

    }

    public UserServiceImpl(UserDao dao){
        this.dao =dao;
    }
    @Override
    public void addNewUser(User user) {
        //调用UserDao的方法保存用户信息
        dao.save(user);
    }

    @Override
    public int getUserCount(String queryUserName, int queryUserRole) {
        return 0;
    }

    @Override
    public com.POJO.User login(String userCode, String userPassword) {
        return null;
    }
}
